//package com.netty.client;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.EnableAsync;
//import org.springframework.scheduling.annotation.SchedulingConfigurer;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
//import org.springframework.scheduling.config.ScheduledTaskRegistrar;
//
//import java.util.concurrent.Executor;
//import java.util.concurrent.Executors;
//import java.util.concurrent.ThreadPoolExecutor;
//
//
//@Configuration
//public class NettyScheduleConfig implements SchedulingConfigurer {
//    @Override
//    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
//        taskRegistrar.setScheduler(Executors.newScheduledThreadPool(10));
//    }
//
//
//    @EnableAsync
//    @Configuration
//    class TaskPoolConfig {
//        @Bean("taskNettyExecutor")
//        public Executor taskExecutor() {
//            ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//            executor.setCorePoolSize(10);
//            executor.setMaxPoolSize(20);
//            executor.setQueueCapacity(200);
//            executor.setKeepAliveSeconds(60);
//            executor.setThreadNamePrefix("taskNettyExecutor-");
//            executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
//            executor.setWaitForTasksToCompleteOnShutdown(true);
//            executor.setAwaitTerminationSeconds(60);
//            return executor;
//        }
//    }
//}